/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Einkaufer;

import java.util.ArrayList;
import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;

/**
 *
 * @author Florian
 */
public class VehiclePartModel implements ComboBoxModel {

    private ArrayList<KomponentenList> vehiclepart;
    

    protected Object selection;


    VehiclePartModel(){
        
        vehiclepart = new ArrayList<KomponentenList>();
        
    }

    public void setSelectedItem(Object anItem) {
         
        this.selection = anItem;


    }

    public int getSize() {
        
        
        return vehiclepart.size();
    }

    public Object getElementAt(int index) {
      
        return vehiclepart.get(index);
    }

    public void addListDataListener(ListDataListener l) {

        
    }

    public void removeListDataListener(ListDataListener l) {
        
    }

    void addElement(KomponentenList komponentenList) {
         vehiclepart.add(komponentenList);
         this.selection = vehiclepart.get(0);
    }

    public Object getSelectedItem() {
       return this.selection;
    }

    
}
